// Your app's root module...
var patientMgmtModule = angular.module('patientMgmtModule', []);


patientMgmtModule.controller('NewPatientCtrl',
  function NewPatientCtrl($scope, $http)
  {
     $scope.addPatient = function (){

        //alert("Patient @ line 10");
    		//alert("Patient - " + $scope.Patient);
        console.log("Patient (JSON) before is ============> " + $scope.Patient);
        var patientJSON = angular.toJson($scope.Patient);
        console.log("Patient (JSON) after is ============> " + patientJSON);

        //alert(JSON.stringify($scope.Patient).replace(',','\n'));

        //$http.post('/HMS_Web/services/ManagePatient/AddPatient',$scope.Patient);
        $http({
          method: 'POST',
          data: $scope.Patient,
          url:'/HMS_Web/services/ManagePatient/AddPatient',
          headers: {'Content-Type':'application/json'}
        });
    };
  }
);
